namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0140 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.hrm_ps_time_att_cal_audit",
                c => new
                    {
                        time_att_cal_audit_seq = c.Int(nullable: false, identity: true),
                        working_year = c.Int(nullable: false),
                        working_month = c.Int(),
                        re_calculate_when = c.DateTime(nullable: false),
                        success = c.Boolean(nullable: false),
                        remarks = c.String(),
                        re_calculate_by_emp_seq = c.Int(),
                        filtered_job_site_seq = c.Int(),
                        filtered_emp_type_seq = c.Int(),
                    })
                .PrimaryKey(t => t.time_att_cal_audit_seq)
                .ForeignKey("dbo.hrm_ps_employees", t => t.re_calculate_by_emp_seq)
                .ForeignKey("dbo.hrm_mp_job_sites", t => t.filtered_job_site_seq)
                .ForeignKey("dbo.hrm_ps_employee_types", t => t.filtered_emp_type_seq)
                .Index(t => t.re_calculate_by_emp_seq)
                .Index(t => t.filtered_job_site_seq)
                .Index(t => t.filtered_emp_type_seq);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.hrm_ps_time_att_cal_audit", new[] { "filtered_emp_type_seq" });
            DropIndex("dbo.hrm_ps_time_att_cal_audit", new[] { "filtered_job_site_seq" });
            DropIndex("dbo.hrm_ps_time_att_cal_audit", new[] { "re_calculate_by_emp_seq" });
            DropForeignKey("dbo.hrm_ps_time_att_cal_audit", "filtered_emp_type_seq", "dbo.hrm_ps_employee_types");
            DropForeignKey("dbo.hrm_ps_time_att_cal_audit", "filtered_job_site_seq", "dbo.hrm_mp_job_sites");
            DropForeignKey("dbo.hrm_ps_time_att_cal_audit", "re_calculate_by_emp_seq", "dbo.hrm_ps_employees");
            DropTable("dbo.hrm_ps_time_att_cal_audit");
        }
    }
}
